{include file="common/head"/}
<style>
    .goods-name {
        font-size: 16px;
        font-weight: 300;
    }
</style>
<div class="admin-main layui-anim layui-anim-upbit" ng-app="hd" ng-controller="ctrl">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>{$title}</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
        <fieldset class="layui-elem-field" style="padding: 10px;">
            <legend>订单基础信息</legend>
            <div class="layui-form-item">
                <label class="layui-form-label">订单号</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.order_no}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">订单价格</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.order_price}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">订单状态</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.order_status_name}" disabled>
                </div>
            </div>
            
            <div class="layui-form-item">
                <label class="layui-form-label">支付方式</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.pay_method_name}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">下单时间</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.order_time}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">支付时间</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.pay_time}" disabled>
                </div>
            </div>
        </fieldset>
        <fieldset class="layui-elem-field" style="padding: 10px;">
            <legend>商品信息</legend>
            {volist name="goods_list" id="vo"}
                <fieldset class="layui-elem-field" style="padding: 10px;">
                    <legend><span class="goods-name">{$vo.goods_name} X {$vo.goods_num}</span></legend>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片</label>
                        <div class="layui-input-4">
                            <img width="35%" src="{$vo.goods_pic}">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">型号</label>
                        <div class="layui-input-4">
                            <input class="layui-input" value="{$vo.sku_name}" disabled>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">价格</label>
                        <div class="layui-input-4">
                            <input class="layui-input" value="{$vo.sku_price}" disabled>
                        </div>
                    </div>
                </fieldset>
            {/volist}
        </fieldset>
        {if ($info.order_status == 3 || $info.order_status == 4) } 
        <fieldset class="layui-elem-field" style="padding: 10px;">
            <legend>发货信息</legend>
            <div class="layui-form-item">
                <label class="layui-form-label">收货地址</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="姓名：{$info.receive_name} 手机：{$info.receive_phone} 住址：{$info.receive_address}"
                        disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">快递公司</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.express_name}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">快递单号</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.express_num}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">发货时间</label>
                <div class="layui-input-4">
                    <input class="layui-input" value="{$info.send_time}" disabled>
                </div>
            </div>
        </fieldset>
        {/if}

        <div class="layui-form-item">
            <div class="layui-input-block">
                <a href="{:url('lists')}" class="layui-btn layui-btn-primary">{:lang('back')}</a>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script src="/static/common/js/angular.min.js"></script>
<script>
    var m = angular.module('hd',[]);
    m.controller('ctrl',['$scope',function($scope) {
        $scope.field = '{$info|raw}'!='null'?{$info|raw}:{id:'', title:'', top:'', important:'', text:''};
        layui.use(['form', 'layer','layedit'], function () {
            var form = layui.form, $ = layui.jquery,layedit = layui.layedit;
            layedit.set({
                uploadImage: {
                    url: "{:url('UpFiles/editUploadLayui')}",
                    type: 'post'
                }
            });
            layedit.sync(noticeText)
            var noticeText = layedit.build('noticeText');
            form.on('submit(submit)', function (data) {
                // 提交到方法 默认为本身
                data.field.id = $scope.field.id;
                data.field.text = layedit.getContent(noticeText);
                console.log(data)
                var loading = layer.load(1, {shade: [0.1, '#fff']});
                $.post("", data.field, function (res) {
                    layer.close(loading);
                    if (res.code > 0) {
                        layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                            location.href = res.url;
                        });
                    } else {
                        layer.msg(res.msg, {time: 1800, icon: 2});
                    }
                });
            });

        });
    }]);
</script>